media_upload_{$type}
Action HookDescription
Fires inside specific upload-type views in the legacy (pre-3.5.0) media popup based on the current tab. The dynamic portion of the hook name, `$type`, refers to the specific media upload type. The hook only fires if the current `$tab` is 'type' (From Computer), 'type_url' (From URL), or, if the tab does not exist (i.e., has not been registered via the {@see 'media_upload_tabs'} filter. Possible hook names include: - `media_upload_audio` - `media_upload_file` - `media_upload_image` - `media_upload_video`Hook Information
File Location |
wp-admin/media-upload.php
View on GitHub
|
Hook Type | Action |
Line Number | 105 |
Hook Parameters
This hook doesn't accept any parameters.
Usage Examples
Basic Usage
<?php
// Hook into media_upload_{$type}
add_action('media_upload_{$type}', 'my_custom_function');
function my_custom_function() {
// Your custom code here
}
Source Code Context
wp-admin/media-upload.php:105
- How this hook is used in WordPress core
<?php
100 * - `media_upload_image`
101 * - `media_upload_video`
102 *
103 * @since 2.5.0
104 */
105 do_action( "media_upload_{$type}" );
106 } else {
107 /**
108 * Fires inside limited and specific upload-tab views in the legacy
109 * (pre-3.5.0) media popup.
110 *
PHP Documentation
<?php
/**
* Fires inside specific upload-type views in the legacy (pre-3.5.0)
* media popup based on the current tab.
*
* The dynamic portion of the hook name, `$type`, refers to the specific
* media upload type.
*
* The hook only fires if the current `$tab` is 'type' (From Computer),
* 'type_url' (From URL), or, if the tab does not exist (i.e., has not
* been registered via the {@see 'media_upload_tabs'} filter.
*
* Possible hook names include:
*
* - `media_upload_audio`
* - `media_upload_file`
* - `media_upload_image`
* - `media_upload_video`
*
* @since 2.5.0
*/
Quick Info
- Hook Type: Action
- Parameters: 0
- File: wp-admin/media-upload.php
Related Hooks
Related hooks will be displayed here in future updates.